package com.tanqidi.mapboxandroid

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import com.mapbox.maps.Style
import com.mapbox.maps.plugin.locationcomponent.location
import com.tanqidi.mapboxandroid.databinding.ActivityMainBinding

class MainActivity : AppCompatActivity() {

    private lateinit var binding: ActivityMainBinding

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        binding = ActivityMainBinding.inflate(layoutInflater)
        setContentView(binding.root)

        setupMap()
    }

    private fun setupMap() {
        val mapView = binding.mapView
        mapView.getMapboxMap().loadStyleUri(Style.MAPBOX_STREETS) {
            //定位到当前位置
            mapView.location.updateSettings {
                enabled = true
                pulsingEnabled = true
            }
        }
    }
}